<?php

namespace App\Console\Commands;

use App\Common\Service\CultivationService;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;

class SettlementCultivation extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'settlement:cultivation';
    protected $cultivationService;
    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '每日结算培育奖';
    /**
     * settlementCultivation constructor.
     * @param CultivationService $cultivationService
     */
    public function __construct(CultivationService $cultivationService)
    {
        $this->cultivationService = $cultivationService;
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $users = DB::table('shop_accounts')->get();
        foreach ($users as $user){
            $this->cultivationService->settlementCultivation($user->uid);
        }
    }
}
